package com.itheima.dao;

import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MemberMapper {

    /**
     * 根据会员id查询会员名称
     * @param memberId
     * @return
     */
    @Select("select name from itcast_health.t_member where id = #{memberId}")
    String findById(Integer memberId);

    /**
     * 根据手机号查询会员信息
     * @param telephone
     * @return
     */
    @Select("select * from itcast_health.t_member where phoneNumber = #{telephone}")
    Member findByTelephone(Integer telephone);

    /**
     * 添加会员
     * @param member
     */
    @Insert("insert into itcast_health.t_member( name, sex, idCard, phoneNumber, regTime, password, email, birthday, remark) value" +
            "(#{name},#{sex},#{idCard},#{phoneNumber},#{regTime},#{password},#{email},#{birthday},#{remark})")
    void add(Member member);
}

